//此方法建立一个AJAX对象   
var ajax;

function createAjaxObject()  
{  
    var ajax;  
    try   
    {  
        ajax= new ActiveXObject("Msxml2.XMLHTTP");  
    }  
    catch(e)  
    {  
        try  
        {  
            ajax = new ActiveXObject("Microsoft.XMLHTTP");  
        }    
        catch(e)  
        {  
             ajax = new XMLHttpRequest();  
        }    
    }    
    return ajax;  
}  

//使用AJAX对象  
function sendToValidata(url, result) //url为访问地址, result为回调函数
{   
	ajax=createAjaxObject();  
    ajax.open("GET",url,true);  
    ajax.onreadystatechange =result;    
    ajax.send(null);   
} 